package com.tanhua.backmanage.controller;


import com.tanhua.backmanage.service.LoginLogService;


import com.tanhua.backmanage.vo.PageResultQs;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;



@RestController
@RequestMapping("manage")
public class LoginLogController {

    @Autowired
    private LoginLogService loginLogService;

//    @RequestParam("type") String type,
    @GetMapping("logs")
    public ResponseEntity<PageResultQs> queryLoginlog(@RequestParam(value = "page", defaultValue = "1") Integer page,
                                                      @RequestParam(value = "pagesize", defaultValue = "10") Integer pageSize,
                                                      @RequestParam("sortProp") String sortProp,
                                                      @RequestParam("sortOrder") String sortOrder,

                                                      @RequestParam("uid") String uid){

        try {
            String type = "1111";
            PageResultQs pageResultQs = loginLogService.queryLoginlog(page, pageSize, sortProp, sortOrder, type,uid);
            return ResponseEntity.ok(pageResultQs);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ResponseEntity.status(996).build();


    }
}
